﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;

public partial class Clinic : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Bind();
        }
    }

    private void Bind()
    {
        if (Session["Name"] == null)
        {
            Response.Write("<script>alert('你还没登录，请先登录账号！');window.location.href='Logon.aspx';</script>");
        }
        else
        {
            string ID = Session["Name"].ToString();
            string sql = string.Format("select * from Seek INNER JOIN Patient ON Seek.IDCard = Patient.IDCard where DocID='{0}'", ID);
            DataSet set = DBHelper.GetDataSet(sql);
            GridView1.DataSource = set;
            GridView1.DataKeyNames = new string[] { "ID" };
            GridView1.DataBind();
        }
    }
    protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        GridView1.PageIndex = e.NewPageIndex;
        Bind();
    }
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        //高亮显示
        e.Row.Attributes.Add("onmouseover", "currentcolor=this.style.backgroundColor;this.style.backgroundColor='#6699ff'");
        e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor=currentcolor");
    }
}